package diertian;

import java.util.Scanner;

public class lianxi5 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入三个数");
        int num1,num2,num3,res;
        num1=scanner.nextInt();
        num2=scanner.nextInt();
        num3=scanner.nextInt();
        System.out.println("交换之前");
        System.out.println("num1 = " + num1);
        System.out.println("num2 = " + num2);
        System.out.println("num3 = " + num3);
        if(num1>num2){
            res=num1;
            num1=num2;
            num2=res;
        }
        if(num1>num3){
            res=num1;
            num1=num3;
            num3=res;
        }
        if (num2>num3){
            res=num2;
            num2=num3;
            num3=res;
        }
        System.out.println("交换后");
        System.out.println("num1 = " + num1);
        System.out.println("num2 = " + num2);
        System.out.println("num3 = " + num3);
    }
}
